<link rel="stylesheet" href="/static/editor.md/css/editormd.min.css" />
<div class="layui-layout layui-layout-admin" style="padding-left: 40px;margin-top: 20px;">
    <form class="layui-form" action="" method="post">
        <input type="hidden" name="id" value="{{.info.Id}}">
        <div class="layui-form-item">
            <label class="layui-form-label">key_name</label>
            <div class="layui-input-block " style="width: 400px">
                <input type="text" name="key_name" id="key_name" lay-verify="required" autocomplete="off"  class="layui-input" value="{{.info.Key_name}}">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">中文</label>
            <div class="layui-input-inline" style="width: 400px">
                <input type="text" name="cn" id="cn" lay-verify="required" autocomplete="off"  class="layui-input" value="{{.info.Cn}}">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">En</label>
            <div class="layui-input-inline" style="width: 400px">
                <input type="text" name="en" id="en" lay-verify="required" autocomplete="off"  class="layui-input" value="{{.info.En}}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">Th</label>
            <div class="layui-input-inline" style="width: 400px">
                <input type="text" name="th" id="th" lay-verify="required" autocomplete="off" class="layui-input" value="{{.info.Th}}">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">系统环境</label>
            <div class="layui-input-inline" style="width: 400px">
                <input type="checkbox" name="codeids" lay-filter="code_ids" title="trunk" value="1">
                <input type="checkbox" name="codeids" lay-filter="code_ids" title="training" value="2">
                <input type="checkbox" name="codeids" lay-filter="code_ids" title="master" value="3">
            </div>
        </div>

        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn" lay-submit="" lay-filter="sub">保存</button>
                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
            </div>
        </div>
    </form>
</div>
<script>
    var templates = {{.templates}}
    var apiEditor;
    layui.use(['form','element','table','layer','jquery'],function(){
        var form = layui.form; //只有执行了这一步，部分表单元素才会自动修饰成功
        var $ = layui.jquery;
        var table = layui.table;

        form.on('submit(sub)', function(data){
            var form_data = data.field;
            console.log(form_data);
            $.post('{{urlfor "KeywordController.AjaxSave"}}', form_data, function (out) {
                if (out.status == 0) {
                    layer.msg("操作成功",{icon: 1},function () {
                        window.location.href="/keyword/adminlist";
                    })
                } else {
                    layer.msg(out.message)
                }
            }, "json");
            return false;
        });

        //但是，如果你的HTML是动态生成的，自动渲染就会失效
        //因此你需要在相应的地方，执行下述方法来手动渲染，跟这类似的还有 element.init();
        form.render();
    });
</script>

{{template "public/editormd_show.html" .}}